require 'rubygems'
require 'common'
require 'texplay'


class W < Gosu::Window
    def initialize
        super(1024, 769, false, 20)
        @img = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
        @gosu = Gosu::Image.new(self, "#{Common::MEDIA}/gosu.png")

#        @img.rect 20,20,100, 100, :fill => true, :texture => @gosu, :alpha_blend => true
#        @img.rect 20,20, 100, 100, :color => [1, 0, 0, 0.1], :alpha_blend => true, :fill => true 
        @img.splice @gosu, 20,20, :color_control => { :add => [0.5, 0.5, 0.5, 0.5]}
        @img.splice @gosu, 100,20, :alpha_blend => true,
        :color_control => proc { |c1, c2, x, y|
            @img.set_pixel x + rand, y + 2 *rand, :color => c2
            :none
        }
            
        
            
    end

    
    # NOTE: turtle is currently written in Ruby so is very slow, look at texplay-contrib.rb for source code.
    def draw

        @img.draw 100, 50,1
    end
    
end


w = W.new
w.show
        
